package com.wnhz.mayabunny.adapter;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class Viewpager_myadapter extends PagerAdapter{
	private int[] imageResId; // ͼƬID
	private List<ImageView> imageViews;
	public Viewpager_myadapter(int[] imageResId,List<ImageView> imageViews) {
		this.imageResId=imageResId;
		this.imageViews=imageViews;
		// TODO Auto-generated constructor stub
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return imageResId.length;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		// TODO Auto-generated method stub
		return arg0==arg1;
	}
	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		((ViewPager) container).addView(imageViews.get(position));
		// TODO Auto-generated method stub
		return imageViews.get(position);
	}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
	((ViewPager) container).removeView((View) object);
}

}
